<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex align-stretch benben-position-layout flex recharge_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex align-center justify-between flex-sub recharge_fd0_0'>
          <view class='flex align-center recharge_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
            <text class='fu-iconfont2  recharge_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex align-center'>
            <text class='recharge_fd0_0_c1_c0'>充值</text>
          </view>
          <view class='flex align-center recharge_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---充值头flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout recharge_flex_1">
        <text class='recharge_fd1_0'>充值金额</text>
        <view class='flex flex-direction flex-wrap align-stretch recharge_fd1_1'>
          <benben-select-diy ref="showSelectPopup1687676735456" class-name='flex flex-wrap align-center flex'
            :items.sync="dataMessage" v-model="payable_money" :label.sync="type_id" default-type="payable_money"
            default-label="aid" :allow-cancel='true' type="radio" :disabled='false'>
            <template v-for='(item,key0) in dataMessage'>
              <view v-if="item.isSelected" class='flex align-center justify-center flex recharge_fd1_1_c0_c0'
                :key="key0" @tap="$refs.showSelectPopup1687676735456.tapHandle(key0)">
                <text class='recharge_fd1_1_c0_c0_c0'>{{item.name}}</text>
                <image class='recharge_fd1_1_c0_c0_c1' mode="aspectFit" :src='STATIC_URL+"95.png"'></image>
              </view>
              <view v-else class='flex align-center justify-center flex recharge_fd1_1_c0_c1' :key="key0"
                @tap="$refs.showSelectPopup1687676735456.tapHandle(key0)">
                <text class='recharge_fd1_1_c0_c1_c0'>{{item.name}}</text>
              </view>
            </template></benben-select-diy>
        </view>
        <text class='recharge_fd1_2'>自定义输入金额</text>
        <view class='flex flex-wrap align-center recharge_fd1_3'>
          <text class='recharge_fd1_3_c0'>￥</text>
          <benben-input class='recharge_fd1_3_c1' type="number" :placeholder="`0.00`" confirm-type="done"
            :maxlength="12" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="payable_money" />
        </view>
        <text class='recharge_fd1_4'>选择支付方式</text>
        <benben-select-diy ref="showSelectPopup1689836356682"
          class-name='flex flex-direction flex-wrap align-stretch flex recharge_fd1_5' :items.sync="payType"
          v-model="pay_id" default-type="value" default-label="name" :allow-cancel='true' type="radio"
          :disabled='false'>
          <template v-for='(item,key0) in payType'>
            <view v-if="item.isSelected" class='flex align-center flex recharge_fd1_5_c0' :key="key0"
              @tap="$refs.showSelectPopup1689836356682.tapHandle(key0)">
              <image class='recharge_fd1_5_c0_c0' mode="aspectFit" :src='item.image'></image>
              <text class='recharge_fd1_5_c0_c1'>{{item.name}}</text>
              <image class='recharge_fd1_5_c0_c2' mode="aspectFit" :src='STATIC_URL+"37.png"'></image>
            </view>
            <view v-else class='flex align-center flex recharge_fd1_5_c0' :key="key0"
              @tap="$refs.showSelectPopup1689836356682.tapHandle(key0)">
              <image class='recharge_fd1_5_c0_c0' mode="aspectFit" :src='item.image'></image>
              <text class='recharge_fd1_5_c0_c1'>{{item.name}}</text>
              <image class='recharge_fd1_5_c0_c2' mode="aspectFit" :src='STATIC_URL+"96.png"'></image>
            </view>
          </template></benben-select-diy>
        <button class='recharge_fd1_6' @tap.stop="getOrderFunc()">充值</button>
      </view>

      <!---充值头flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "type": [{
          "name": "100元",
          "value": "1",
          "image": ""
        }, {
          "name": "200元",
          "value": "2",
          "image": ""
        }, {
          "name": "300元",
          "value": "3",
          "image": ""
        }, {
          "name": "400元",
          "value": "4",
          "image": ""
        }, {
          "name": "500元",
          "value": "5",
          "image": ""
        }, {
          "name": "600元",
          "value": "6",
          "image": ""
        }],
        "type_id": "1",
        "payType": [{
          "name": "微信",
          "value": "wx",
          "image": require('@/static/images/93.png')
        }, {
          "name": "",
          "value": "",
          "image": require('@/static/images/94.png')
        }],
        "pay_id": "wx",
        "dataMessage": [],
        "payable_money": "",
        "dataDetails": {
          "order_sn": "",
          "payable_money": ""
        }
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.getTypeFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //钱包-获取充值规则
      async getTypeFunc() {
        //请求方法
        //数据验证

        let datadataMessage = await this.$api.get(global.apiUrls.post636f522d2dbe9, {

        });

        if (datadataMessage.data.code != 1) {
          this.$message.info(datadataMessage.data.msg);
          return
        }
        let infodataMessage = datadataMessage.data;
        this.dataMessage = infodataMessage.data

      },
      //钱包-生成充值订单
      async getOrderFunc() {
        if (!validate(this.payable_money, 'require')) {
          this.$message.info('请输入充值金额');
          return false;
        }
        //请求方法
        //数据验证

        let datadataDetails = await this.$api.dbPost(global.apiUrls.post636f632a12277, {
          payable_money: this.payable_money,
          product_id: this.type_id,
          pay_type: this.pay_id
        });
        if (!datadataDetails) return
        if (datadataDetails.data.code != 1) {
          this.$message.info(datadataDetails.data.msg);
          return
        }
        let infodataDetails = datadataDetails.data;
        this.dataDetails = infodataDetails.data

        this.$urouter.navigateBack(1);
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: var(--benbenbgColor1);
    background-size: 100% auto;
  }

  .recharge_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .recharge_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
  }

  .recharge_fd0_0_c0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: #333;
  }

  .recharge_fd0_0_c0 {
    width: 180rpx;
  }

  .recharge_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
  }

  .recharge_flex_1 {
    background: #fff;
    background-size: 100% auto !important;
    padding: 30rpx 0rpx 0rpx 0rpx;
  }

  .recharge_fd1_6 {
    background: var(--benbenbgColor2);
    border-radius: 50rpx 50rpx 50rpx 50rpx;
    font-size: 32rpx;
    color: var(--benbenFontColor3);
    width: 686rpx;
    height: 88rpx;
    line-height: 88rpx;
    font-weight: 500;
    position: fixed;
    left: 32rpx;
    bottom: calc(40rpx + var(--window-bottom));
  }

  .recharge_fd1_5_c0_c2 {
    width: 36rpx;
    height: 36rpx;
    border-radius: 18rpx 18rpx 18rpx 18rpx;
    margin: 0rpx 0rpx 0rpx auto;
  }

  .recharge_fd1_5_c0_c1 {
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
  }

  .recharge_fd1_5_c0_c0 {
    width: 52rpx;
    height: 52rpx;
    border-radius: 26rpx 26rpx 26rpx 26rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .recharge_fd1_5_c0 {
    padding: 18rpx 0rpx 18rpx 0rpx;
  }

  ::v-deep .recharge_fd1_5 {
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .recharge_fd1_4 {
    margin: 40rpx 32rpx 20rpx 32rpx;
    font-size: 32rpx;
    font-weight: 700;
    color: #333;
  }

  .recharge_fd1_3_c1 {
    font-size: 32rpx;
    font-weight: 400;
    color: #333;
  }

  .recharge_fd1_3_c0 {
    font-size: 40rpx;
    font-weight: 400;
    color: #333;
    margin: 0rpx 38rpx 0rpx 0rpx;
  }

  .recharge_fd1_3 {
    border-bottom: 1px solid #eee;
    margin: 0rpx 32rpx 0rpx 32rpx;
    padding: 0rpx 0rpx 30rpx 0rpx;
  }

  .recharge_fd1_2 {
    margin: 32rpx 32rpx 20rpx 32rpx;
    font-weight: 700;
    font-size: 32rpx;
    color: #333;
  }

  .recharge_fd1_1_c0_c1_c0 {
    font-size: 32rpx;
    font-weight: 400;
    color: rgba(26, 26, 26, 1);
    line-height: 45rpx;
  }

  .recharge_fd1_1_c0_c1 {
    border: 1px solid rgba(179, 146, 146, 1);
    margin: 0rpx 7rpx 36rpx 7rpx;
    width: 220rpx;
    height: 120rpx;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
  }

  .recharge_fd1_1_c0_c0_c1 {
    width: 44rpx;
    height: 44rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    position: absolute;
    top: -1rpx;
    right: -1rpx;
  }

  .recharge_fd1_1_c0_c0_c0 {
    font-size: 32rpx;
    font-weight: 400;
    color: var(--benbenFontColor5);
    line-height: 45rpx;
  }

  .recharge_fd1_1_c0_c0 {
    border: 1px solid var(--benbenbdColor2);
    width: 220rpx;
    height: 120rpx;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    position: relative;
    margin: 0rpx 7rpx 36rpx 7rpx;
  }

  .recharge_fd1_1 {
    padding: 0rpx 0rpx 0rpx 25rpx;
  }

  .recharge_fd1_0 {
    margin: 0rpx 32rpx 24rpx 32rpx;
    font-weight: 700;
    font-size: 32rpx;
    color: rgba(51, 51, 51, 1);
  }
</style>
